<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>DOM更新</title>
  </head>
  <body>
    <button id="btn">点我更新DOM</button>
    <p id="output">初始文本</p>

    <script>
      const btn = document.querySelector("#btn");
      const output = document.querySelector("#output");

      btn.onclick = function () {
        output.textContent = "更新后的文本";
        console.dir(output);
      };
    </script>
  </body>
</html>
